import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  },
  {
    path: '/register',
    component: () => import('@/views/register/index'),
    hidden: true
  },
  {
    path: '/',
    component: () => import('@/views/layout'),
    redirect: '/home', // 默认显示首页的二级路由
    children: [
      {
        path: 'home',
        component: () => import('@/views/home')
      }
    ]
  },
  {
    path: '/article',
    component: () => import('@/views/layout'),
    redirect: '/article', // 默认显示首页的二级路由
    children: [
      {
        path: '/art_cate',
        component: () => import('@/views/article/art_cate')
      },
      {
        path: '/art_list',
        component: () => import('@/views/article/art_list')
      }
      // {
      //   path: '/art_pub',
      //   component: () => import('@/views/article/art_pub')
      // }
    ]
  },
  {
    path: '/userinfo',
    component: () => import('@/views/layout'),
    redirect: '/user', // 默认显示首页的二级路由
    children: [
      {
        path: '/userinfo',
        component: () => import('@/views/user/userinfo')
      },
      {
        path: '/user_avatar',
        component: () => import('@/views/user/user_avatar')
      },
      {
        path: '/user_pwd',
        component: () => import('@/views/user/user_pwd')
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
